<?php

class Kd_Data_Dcl_Expression_Join extends Kd_Data_Dcl_Expression_Base {

    public function __construct() {
        parent::__construct();
    }

    public function innerOn($name, $alias, $left, $right) {
        $this->inner($name, $alias)->on($left, $right);
        return $this;
    }

    public function leftOn($name, $alias, $left, $right) {
        $this->left($name, $alias)->on($left, $right);
        return $this;
    }

    public function rightOn($name, $alias, $left, $right) {
        $this->right($name, $alias)->on($left, $right);
        return $this;
    }

    public function inner($name, $alias = '') {
        $relation = new Kd_Data_Dcl_Expression_Relation($name, $alias);
        $relation->setRelationType('inner');
        $this->addExpression($relation);
        return $relation;
    }

    public function left($name, $alias = '') {
        $relation = new Kd_Data_Dcl_Expression_Relation($name, $alias);
        $relation->setRelationType('left');
        $this->addExpression($relation);
        return $relation;
    }

    public function right($name, $alias = '') {
        $relation = new Kd_Data_Dcl_Expression_Relation($name, $alias);
        $relation->setRelationType('right');
        $this->addExpression($relation);
        return $relation;
    }

    public function getExpressionType() {
        return 'join';
    }

}